package com.it.domain.DTO;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.it.domain.Inventory;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;

@Data
public class InventoryListDTO {
    private Integer inventoryId;
    private Integer productId;
    private Integer quantity;
    private String location;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

public static InventoryListDTO convertToDTO(Inventory inventory) {

    InventoryListDTO dto = new InventoryListDTO();
    dto.setInventoryId(inventory.getInventoryId());
    dto.setProductId(inventory.getProductId());
    dto.setQuantity(inventory.getQuantity());
    dto.setLocation(inventory.getLocation());
    dto.setUpdateTime(inventory.getUpdateTime());
    return dto;
}}